// run: time -p $exec < input
// opt: 0
// flag: -g
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <unordered_map>
#include <unordered_set>

template <class T>
void scan(T & a)
{
	a = 0;
	bool flag = false;
	char ch = std::getchar();
	if (ch == '-')
		flag = true;
	else if (ch >= '0' && ch <= '9')
		a = ch - '0';

	while ((ch = std::getchar()) >= '0' && ch <= '9')
		a = a * 10 + ch - '0';
	if (flag) a = -a;
}

struct data { long long x, y; };
using pair = std::pair<long long, long long>;
using tuple = std::tuple<long long, long long, long long>;

struct pair_hash
{
	std::size_t operator()(pair const& k) const
	{
		return std::hash<long long>()(k.first) ^
			(std::hash<long long>()(k.second) << 4);
	}
};

struct pair_equal
{
	bool operator()(const pair& lhs, const pair& rhs) const
	{
		return lhs.first == rhs.first && lhs.second == rhs.second;
	}
};

struct tuple_hash
{
	std::size_t operator()(tuple const& k) const
	{
		return std::hash<long long>()(std::get<0>(k)) ^
			(std::hash<long long>()(std::get<1>(k)) << 4) ^
			(std::hash<long long>()(std::get<2>(k)) << 8);
	}
};

struct tuple_equal
{
	bool operator()(const tuple& lhs, const tuple& rhs) const
	{
		return std::get<0>(lhs) == std::get<0>(rhs) &&
			std::get<1>(lhs) == std::get<1>(rhs) &&
			std::get<2>(lhs) == std::get<2>(rhs);
	}
};

long long const mo = 1000000007;
long long const maxn = 1007;
long long n;

template <class T>
T abs(T x) { return x < 0 ? -x : x; }

template <class T>
T gcd(T x, T y) { return !y ? x : gcd(y, x % y); }

tuple normal(pair const& u, pair const& v)
{
	long long a = v.second - u.second;
	long long b = u.first - v.first;
	long long c = a * u.first + b * u.second;
	long long tmp = gcd(gcd(abs(a), abs(b)), abs(c));
	a /= tmp; b /= tmp; c /= tmp;
	if (a < 0) {
		a = -a; b = -b; c = -c;
	} else if (!a) {
		if (b < 0) {
			b = -b; c = -c;
		} else if (!b) c = abs(c);
	}
	return std::make_tuple(a, b, c);
}

long long quick(long long a, long long b)
{
	if (!b) return 1;
	long long ret = quick(a, b / 2);
	ret = (ret * ret) % mo;
	if (b & 1) ret = (ret * a) % mo;
	return ret;
}

std::unordered_map<tuple, long long, tuple_hash, tuple_equal> mm;
std::unordered_set<tuple, tuple_hash, tuple_equal> all;
std::vector<tuple> tall;
std::unordered_map<pair, long long, pair_hash, pair_equal> dis;

pair da[maxn];
long long cp[maxn];
long long countpass[maxn];
long long len;

int main()
{
	long long T; scan(T);
	while (T--) {
		scan(n);
		dis.clear();
		len = 0;
		for (long long i = 0; i < n; i++) {
			countpass[i] = 0;
			scan(da[i].first); scan(da[i].second);
			if (dis.count(da[i])) {
				cp[dis[da[i]]]++;
			} else {
				dis[da[i]] = len;
				da[len] = da[i];
				cp[len++] = 1;
			}
		}

		all.clear();
		long long ans = 0;
		for (long long i = 0; i < len; i++) {
			mm.clear();
			tall.clear();
			long long count = cp[i];
			for (long long j = i + 1; j < len; j++) {
				auto tmp = normal(da[i], da[j]);
//				std::cerr << i << " "  << j << "  " << std::get<0>(tmp) << " " << std::get<1>(tmp) << " " << std::get<2>(tmp) << "\n";
				if (all.count(tmp)) continue;
				countpass[j]++;
				countpass[i]++;
				mm[tmp] += cp[j];
				tall.push_back(tmp);
			}

			for (auto t : mm) {
				long long x = t.second + count;
				ans += quick(2, x) - x - 1;
				ans = (ans + mo) % mo;
			}

			for (auto t : tall) all.insert(t);
		}

		/*
		std::cerr << ans << "\n";
		for (long long i = 0; i < len; i++) {
			std::cout << i << " "  << cp[i] << "  " << countpass[i] << "\n";
		}
		*/

		for (long long i = 0; i < len; i++) {
			long long tmp = quick(2, cp[i]) - cp[i] - 1;
			tmp *= (countpass[i] - 1);
			tmp %= mo;
			ans -= tmp;
			ans %= mo;
			ans = (ans + mo) % mo;
		}
		printf("%lld\n", ans);
	}
}

